<?php

namespace App\Admin\Traits;
use App\Models\Client;
use App\Models\Department;
use Encore\Admin\Widgets\Tab;
use Illuminate\Support\Facades\Request;

trait statBtn{



    public static function tabMenuList(){
        $curl = explode("?",Request::getRequestUri())[0];
        $new = str_replace(['/single','/department'],'',$curl);

        if($new == '/admin'){
            $new = '/admin/stat/call';
        }

        $menuList = [
            '个人排行'=>"$new/single",
            '部门排行'=>"$new/department",
        ];
        $tab = new Tab();
        foreach ($menuList as $k => $m){
            $active = $m == $curl ? true : false;
            $tab->addLink($k,$m,$active);
        }
        return $tab->render();
    }



}
